<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>
<body>

<!--
@desc  更新
@author WeiXiaoJin
@since 2020-01-30 11:21:01
-->

	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="modifyForm">

									<input type="hidden" name="id" th:value="${bean.id}" />
									
<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">选择器id </label>
	<div class="col-md-9">
				<input class="form-control" id="selectorId" type="text" th:value="${ bean.selectorId}" name="selectorId" placeholder="选择器id">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">匹配方式（0 and  1 or) </label>
	<div class="col-md-9">
				<input class="form-control" id="matchMode" type="text" th:value="${ bean.matchMode}" name="matchMode" placeholder="匹配方式（0 and  1 or)">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">规则名称 </label>
	<div class="col-md-9">
				<input class="form-control" id="name" type="text" th:value="${ bean.name}" name="name" placeholder="规则名称">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">是否开启 </label>
	<div class="col-md-9">
				<input class="form-control" id="enabled" type="text" th:value="${ bean.enabled}" name="enabled" placeholder="是否开启">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">是否记录日志 </label>
	<div class="col-md-9">
				<input class="form-control" id="loged" type="text" th:value="${ bean.loged}" name="loged" placeholder="是否记录日志">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">排序 </label>
	<div class="col-md-9">
				<input class="form-control" id="sort" type="text" th:value="${ bean.sort}" name="sort" placeholder="排序">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">处理逻辑（此处针对不同的插件，会有不同的字段来标识不同的处理，所有存储json格式数据） </label>
	<div class="col-md-9">
				<input class="form-control" id="handle" type="text" th:value="${ bean.handle}" name="handle" placeholder="处理逻辑（此处针对不同的插件，会有不同的字段来标识不同的处理，所有存储json格式数据）">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">创建时间 </label>
	<div class="col-md-9">
				<div class="input-group date">
			<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			<input type="text" class="form-control time-input" 
			       id="dateCreated-3" name="dateCreated" 
				   th:value="${ #dates.format(bean.dateCreated, 'yyyy-MM-dd HH:mm:ss')}" 
			       data-type="datetime" 
			       data-format="yyyy-MM-dd HH:mm:ss" 
			       placeholder="yyyy-MM-dd HH:mm:ss" lay-key="dateCreated-3">
		</div>
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">更新时间 </label>
	<div class="col-md-9">
				<div class="input-group date">
			<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			<input type="text" class="form-control time-input" 
			       id="dateUpdated-3" name="dateUpdated" 
				   th:value="${ #dates.format(bean.dateUpdated, 'yyyy-MM-dd HH:mm:ss')}" 
			       data-type="datetime" 
			       data-format="yyyy-MM-dd HH:mm:ss" 
			       placeholder="yyyy-MM-dd HH:mm:ss" lay-key="dateUpdated-3">
		</div>
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">接受IP </label>
	<div class="col-md-9">
				<input class="form-control" id="accessip" type="text" th:value="${ bean.accessip}" name="accessip" placeholder="接受IP">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">认证类型 </label>
	<div class="col-md-9">
				<input class="form-control" id="authType" type="text" th:value="${ bean.authType}" name="authType" placeholder="认证类型">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">客户端超时 </label>
	<div class="col-md-9">
				<input class="form-control" id="clientOuttime" type="text" th:value="${ bean.clientOuttime}" name="clientOuttime" placeholder="客户端超时">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">限制IP </label>
	<div class="col-md-9">
				<input class="form-control" id="denyip" type="text" th:value="${ bean.denyip}" name="denyip" placeholder="限制IP">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">加密方式 </label>
	<div class="col-md-9">
				<input class="form-control" id="encType" type="text" th:value="${ bean.encType}" name="encType" placeholder="加密方式">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">是否加密 </label>
	<div class="col-md-9">
				<input class="form-control" id="hasEncryption" type="text" th:value="${ bean.hasEncryption}" name="hasEncryption" placeholder="是否加密">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">是否熔断 </label>
	<div class="col-md-9">
				<input class="form-control" id="hasHystrix" type="text" th:value="${ bean.hasHystrix}" name="hasHystrix" placeholder="是否熔断">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">是否可访问 </label>
	<div class="col-md-9">
				<input class="form-control" id="hasOpen" type="text" th:value="${ bean.hasOpen}" name="hasOpen" placeholder="是否可访问">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">熔断器内容 </label>
	<div class="col-md-9">
				<input class="form-control" id="hystrixContent" type="text" th:value="${ bean.hystrixContent}" name="hystrixContent" placeholder="熔断器内容">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">限流 </label>
	<div class="col-md-9">
				<input class="form-control" id="limitRequest" type="text" th:value="${ bean.limitRequest}" name="limitRequest" placeholder="限流">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">服务端超时时间 </label>
	<div class="col-md-9">
				<input class="form-control" id="serverOuttime" type="text" th:value="${ bean.serverOuttime}" name="serverOuttime" placeholder="服务端超时时间">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">禁止关闭时间 </label>
	<div class="col-md-9">
				<div class="input-group date">
			<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			<input type="text" class="form-control time-input" 
			       id="closeTime-3" name="closeTime" 
				   th:value="${ #dates.format(bean.closeTime, 'yyyy-MM-dd HH:mm:ss')}" 
			       data-type="datetime" 
			       data-format="yyyy-MM-dd HH:mm:ss" 
			       placeholder="yyyy-MM-dd HH:mm:ss" lay-key="closeTime-3">
		</div>
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">解密代码 </label>
	<div class="col-md-9">
				<input class="form-control" id="decodeStr" type="text" th:value="${ bean.decodeStr}" name="decodeStr" placeholder="解密代码">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">全局头部 </label>
	<div class="col-md-9">
				<input class="form-control" id="globalHeader" type="text" th:value="${ bean.globalHeader}" name="globalHeader" placeholder="全局头部">
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">开始访问时间 </label>
	<div class="col-md-9">
				<div class="input-group date">
			<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			<input type="text" class="form-control time-input" 
			       id="openTime-3" name="openTime" 
				   th:value="${ #dates.format(bean.openTime, 'yyyy-MM-dd HH:mm:ss')}" 
			       data-type="datetime" 
			       data-format="yyyy-MM-dd HH:mm:ss" 
			       placeholder="yyyy-MM-dd HH:mm:ss" lay-key="openTime-3">
		</div>
			</div>
</div>
												<div class="form-group row">
	<label class="col-md-2 col-form-label control-label" for="text-input">重试次数 </label>
	<div class="col-md-9">
				<input class="form-control" id="retrics" type="text" th:value="${ bean.retrics}" name="retrics" placeholder="重试次数">
			</div>
</div>
																				</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>

	<script type="text/javascript">
		var modifyForm = $("#modifyForm") ; 
		$(function(){
			addForm.validate({
				ignore: [],  
				rules: {
selectorId: {required:true}
,matchMode: {required:true}
,name: {required:true}
,enabled: {required:true}
,loged: {required:true}
,sort: {required:true}
,handle: {required:true}
,dateCreated: {required:true}
,dateUpdated: {required:true}
,accessip: {required:true}
,authType: {required:true}
,clientOuttime: {required:true}
,denyip: {required:true}
,encType: {required:true}
,hasEncryption: {required:true}
,hasHystrix: {required:true}
,hasOpen: {required:true}
,hystrixContent: {required:true}
,limitRequest: {required:true}
,serverOuttime: {required:true}
,closeTime: {required:true}
,decodeStr: {required:true}
,globalHeader: {required:true}
,openTime: {required:true}
,retrics: {required:true}
				}
			});
		}) ;

		function submitHandler() {
			var result = $.validate.form("modifyForm");
			if(result){	
				var modifyUrl = ctx+"gateway/admin/gateRule/update" ;
				$.operate.save(modifyUrl , modifyForm.serialize());
			}
	    }
	</script>
</body>
</html>
